/**   
 * 项目名：五位一体化工安全信息平台
 * 日期：    2019-12-10 08:31:10  
 * Copyright (c) 2015- joysuch-版权所有     
 */

package com.joysuch.wwyt.core.entity;

import static javax.persistence.GenerationType.IDENTITY;
import java.util.Set;
import java.util.LinkedHashSet;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedStoredProcedureQueries;
import javax.persistence.NamedStoredProcedureQuery;
import javax.persistence.ParameterMode;
import javax.persistence.StoredProcedureParameter;
import javax.persistence.Table;
import javax.persistence.EntityListeners;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@EntityListeners({ AuditingEntityListener.class, AutoSetCommonFieldListener.class })
@Entity
@Table(name = "WWYT_BASE_BIZ_CODE_SEED")
@NamedStoredProcedureQueries({
        @NamedStoredProcedureQuery(name = "biz_code_seed_generator", procedureName = "pzh", parameters = {
                @StoredProcedureParameter(mode = ParameterMode.IN, name = "types", type = String.class),
                @StoredProcedureParameter(mode = ParameterMode.IN, name = "tenentId", type = Long.class),
                @StoredProcedureParameter(mode = ParameterMode.IN, name = "orgCode", type = String.class),
                @StoredProcedureParameter(mode = ParameterMode.OUT, name = "ddh_return", type = Long.class) }) })
public class BaseBizCodeSeed implements java.io.Serializable{
    
    //columns START
    //ID
    private Long id;
    //租户
    private Long tenentId;
    //业务点
    private String bizPoint;
    //前缀
    private String prefix;
    //长度
    private Integer length;
    //种子
    private Long seed;
    //类型
    private Integer type;
    //组织机构代码
    private String orgCode;
   //版本
    private Long version;
    //columns END


    public void setId(Long value) {
        this.id = value;
    }
    
    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "Id", unique = true, nullable = false)
    public Long getId() {
        return this.id;
    }
    
     
    @Column(name = "TENENT_ID")
    public Long getTenentId() {
        return this.tenentId;
    }
    
    public void setTenentId(Long value) {
        this.tenentId = value;
    }
    
     
    @Column(name = "BIZ_POINT", length = 2)
    public String getBizPoint() {
        return this.bizPoint;
    }
    
    public void setBizPoint(String value) {
        this.bizPoint = value;
    }
    
     
    @Column(name = "PREFIX", length = 5)
    public String getPrefix() {
        return this.prefix;
    }
    
    public void setPrefix(String value) {
        this.prefix = value;
    }
    
     
    @Column(name = "LENGTH")
    public Integer getLength() {
        return this.length;
    }
    
    public void setLength(Integer value) {
        this.length = value;
    }
    
     
    @Column(name = "SEED")
    public Long getSeed() {
        return this.seed;
    }
    
    public void setSeed(Long value) {
        this.seed = value;
    }
    
     
    @Column(name = "TYPE")
    public Integer getType() {
        return this.type;
    }
    
    public void setType(Integer value) {
        this.type = value;
    }
    
     
    @Column(name = "ORG_CODE", length = 100)
    public String getOrgCode() {
        return this.orgCode;
    }
    
    public void setOrgCode(String value) {
        this.orgCode = value;
    }

    @Column(name = "VERSION")
    public Long getVersion() {return version;}

    public void setVersion(Long version) { this.version = version; }

    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id",getId())
            .append("tenentId",getTenentId())
            .append("bizPoint",getBizPoint())
            .append("prefix",getPrefix())
            .append("length",getLength())
            .append("seed",getSeed())
            .append("type",getType())
            .append("orgCode",getOrgCode())
            .append("version",getVersion())
            .toString();
    }
    
    public int hashCode() {
        return new HashCodeBuilder()
            .append(getId())
            .toHashCode();
    }
    
    public boolean equals(Object obj) {
        if(obj instanceof BaseBizCodeSeed == false) return false;
        if(this == obj) return true;
        BaseBizCodeSeed other = (BaseBizCodeSeed)obj;
        return new EqualsBuilder()
            .append(getId(),other.getId())
            .isEquals();
    }
}

